PEP 1, 12 and template: update style - #5082
Conversation
Documentation build overview
9 files changed ·
|
warsaw
left a comment
There was a problem hiding this comment.
I'm -1 on changing the PEP 12 template away from all-caps headers, for the reasons given below. -0 for changing PEP 1 headers. The other improvements (e.g. not using .e.g. 😄 ) and fixing the case for reStructuredText seem fine though!
|
|
||
|
|
||
| Backwards Compatibility | ||
| Backwards compatibility |
There was a problem hiding this comment.
I don't think we should change the template. There's nothing wrong with the existing all-caps headers except that it doesn't conform to our current standard. Consistency is useful, but what does PEP 8 say about consistency? 😄
Since we already have so many PEPs that are using this template, changing it does introduce a larger inconsistency! All those PEPs using the all-caps headers will be inconsistent and I don't think we should go back and change them.
Yes, we have to accept drift when we add a new section (such as Change History) or re-order them (like Rationale moved to after Specification), but there were some substantive reasons behind those changes.
There was a problem hiding this comment.
If anything, I'd prefer to drop the changes in PEP 1/12 and only change the template :D
PEP 8 has hobgoblins and also:
Consistency within a project is more important. Consistency within one module or function is the most important.
Indeed, individual PEPs are more like standalone documents than our main docs, which form an editorial whole.
And knowing when to be inconsistent:
-
We don't apply the style guide as rigorously to PEPs as the docs, and I usually don't bother with the same style nits in PEP reviews.
-
Changing the template is for consistency within single PEPs, and for future ones, and not worrying about all the historical ones.
The docs style guide mirrors the PEP 8 text above about consistency in smaller units:
In the Python documentation, the use of sentence case in section titles is preferable, but consistency within a unit is more important than following this rule. If you add a section to a chapter where most sections are in title case, you can either convert all titles to sentence case or use the dominant style in the new section title.
PEP 84x
Looking at the 84x PEPs (skipping 840 that doesn't use the usual template and anyway only has inconclusive single-word headers!):
| 841 | 842 | 843 | 844 |
|---|---|---|---|
|
|
|
|
These authors added their own subheadings in Sentence case, so are now inconsistent with the Title Case main headings. If the main template headings were Sentence case, these would be consistent.
PEP 83x
Looking at the 83x:
-
Title Case headings + Title Case subheadings: 830, 831, 835, 836
-
Title Case headings + Sentence case subheadings: 832, 833, 834, 837, 838, 839
Altogether 83x+84x have 10 with Sentence case subheadings, 4 with Title Case.
PEP xxx
Getting an LLM to categorise the whole bunch:
| Headings | Subheadings | PEPs |
|---|---|---|
| Title Case | Sentence case | 223 |
| Title Case | Title Case | 140 |
| Sentence case | Sentence case | 95 |
| Sentence case | Title Case | 0 |
| Unknown / mixed / no subheadings | 274 | |
| Total | 732 |
The majority with Title Case headings use Sentence case subheadings. Changing the default would have improved internal consistency.
I'd argue many of the TC + TC authors were being consistent and just matched the main heading style, so if we flipped the template, they would have remained consistent with Sc + Sc, not Sc + TC.
And interestingly, there are none with Sc + TC.
Flipping the template would match both our style, and authors' own preference.
|
|
||
|
|
||
| PEP Audience | ||
| PEP audience |
There was a problem hiding this comment.
Changing PEP 1's headers is fine in isolation since it's not a template, but ... is it worth it? We have so many all-caps headers in the PEPs, I'm not so sure.




We usually don't review PEPs to the same level as the main docs following our style guide, as each PEP is more of a standalone document compared to the docs' editorial whole; and also not to delay publishing and discussing PEPs: authoring and shepherding a PEP is a big task as it is.
However, let's update PEP 1, 12 and especially the template to set an example.